package com.beibojd.service.impl;

import com.beibojd.dao.AdminMapper;
import com.beibojd.pojo.Admin;
import com.beibojd.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

/**
 * @Author: 洪耀荣
 * @Date: 2021-06-23 18:03:12
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Boolean selectAdmin(Admin admin) {
        System.out.println(admin.toString());
        Example example = new Example(Admin.class);
        example.createCriteria().andEqualTo("name", admin.getName());
        example.createCriteria().andEqualTo("password",admin.getPassword());
        Admin admin1=adminMapper.selectOneByExample(example);
        if (admin.getPassword().equals(admin1.getPassword())){
            return true;
        }else {
            return false;
        }
    }
}
